home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_01_05
/
1n05025a
< prev
next >
Wrap
Text File
|
1990-08-29
|
2KB
|
50 lines
.***************** PROGRAM SECTION START ******************
.
.
.
DOMOVES PROC NEAR
;
; THIS ROUTINE WILL TAKE THE PLACE OF ANY (REP MOVSW) PROCESS.
; BY CALLING THIS ROUTINE INSTEAD OF USING (REP MOVSW) INSTRUCTIONS, YOU
; WILL INCREASE THE SPEED OF MEMORY MOVING SIGNIFICANTLY ON 386 AND 486
; CPU BASED MACHINES.
;
; SINCE THIS IS A (REP MOVSW) REPLACEMENT IT STANDS TO REASON THAT ANY
; AND ALL REQUIREMENTS OF THE (REP MOVSW) INSTRUCTION ARE STILL
; REQUIRED. FOR EXAMPLE:
;
; DS:SI POINTS TO SOURCE MEMORY
; ES:DI POINTS TO DESTINATION MEMORY
; CX NUMBER OF WORDS TO MOVE
;
;
; SHOULD I DO 386 (32 BIT MOVES?)
;
CMP DS:CPUTYPE,6 ;AM I ON A 386?
JZ RPMX386B
REP MOVSW ;NO JUST DO REGULAR REPEAT WORD MOVES
JMP NO386B ;DONE
RPMX386B:
;
; IF 386 THEN MOVE AS MANY DOUBLE WORD MULTIPLES AS YOU CAN THEN
; IF THERE WAS AN ODD NUMBER OF WORDS TO MOVE, FINISH OUT WITH
; A FINAL WORD MOVE.
;
SHR CX,1 ;CX=HOW MANY DOUBLE WORDS TO MOVE
.386 ;TELLS TURBO ASSEMBLER TO USE 386 OPCODES
REP MOVSD
.8086 ;SWITCHES BACK TO 8088-8086 OPCODES
JNC NO386B ;WAS THERE AN ODD NUMBER OF WORDS?
MOV CX,1
REP MOVSW ;IF SO THEN FINISH OUT LAST MOVE
NO386B:
RET
DOMOVES ENDP
.
.
.
.***************** PROGRAM SECTION END ******************